package com.ruoyi.utils;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.config.alibaba.AliOSSUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Slf4j
@RestController
@RequestMapping("/User/oss")
public class UploadController {
    @Autowired
    private AliOSSUtils aliOSSUtils;

    @PostMapping("/upload")
    public AjaxResult upload(MultipartFile file) throws IOException {
        String url = aliOSSUtils.upload(file);
        return AjaxResult.success(url);
    }





}
